package com.yichen.ycOJ.judge.strategy;

/**
 * @Author: yichenwu
 * @Date:2024/6/24 16:16
 */

import com.yichen.ycOJ.model.dto.judge.JudgeContext;
import com.yichen.ycOJ.model.dto.questionSubmit.JudgeInfo;
import com.yichen.ycOJ.model.enums.QuestionSubmitLanguageEnum;

import java.util.List;

/**
 * 判题管理（简化调用）
 */
public class JudgeStrategyManager {
    public static List<JudgeInfo> getJudgeStrategy(JudgeContext judgeContext) {
        List<JudgeInfo> judgeInfo = new DefaultStrategy().doJudge(judgeContext);
        QuestionSubmitLanguageEnum enumByValue = QuestionSubmitLanguageEnum.getEnumByValue(judgeContext.getLanguage());
        switch (enumByValue) {
            case JAVA:
                judgeInfo = new JavaJudgeStrategy().doJudge(judgeContext);
                break;
            case PYTHON:
            case CPLUSPLUS:
            default:
                return judgeInfo;
        }
        return judgeInfo;
    }
}
